package cn.kuporo.seckill.stock.application.model.dto;

import cn.kuporo.seckill.stock.domain.model.entity.SeckillStockBucket;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author: kuporo
 * @since: 2025/8/2
 * @description: 库存DTO
 */
@Data
@NoArgsConstructor
public class SeckillStockBucketDTO {
    /**
     * 库存总量
     */
    private Integer totalStock;
    /**
     * 可用库存量
     */
    private Integer availableStock;
    /**
     * 分桶数量
     */
    private Integer bucketsQuantity;
    /**
     * 库存分桶信息
     */
    private List<SeckillStockBucket> buckets;

    public SeckillStockBucketDTO(Integer totalStock, Integer availableStock, List<SeckillStockBucket> buckets) {
        this.totalStock = totalStock;
        this.availableStock = availableStock;
        this.buckets = buckets;
        this.bucketsQuantity = buckets.size();
    }
}
